using System.Collections.Generic;
using UnityEngine;

public class State_Machine : MonoBehaviour
{
    IState Current_State;

    protected Dictionary<System.Type, IState> Player_StateTable;

    void Update()
    {
        Current_State.LogicUpdate();
    }
    void FixedUpdate()
    {
        Current_State.PhysicUptate();
    }

    protected void Switch_On(IState newState)
    {
        Current_State = newState;
        Current_State.Enter();
    }

    public void Switch_State(IState newState)
    {
        Current_State.Exit();
        Switch_On(newState);
    }


    public void Switch_State(System.Type newStateType)
    {
        Switch_State(Player_StateTable[newStateType]);
    }

}
